import java.util.Random;
import java.util.Scanner;

public class test1 {
    //100到200之间既能被3整除，又能被4整除的所有数，使用continue
/*    public static void main(String[] args) {
        int i = 100;
        while(i <= 200){
            if(i % 12 != 0){
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }

    }*/
    //不使用用continue
/*
    public static void main(String[] args) {
        int i = 100;
        while(i <=200){
            if(i % 3 == 0 && i % 4 ==0)
                System.out.println(i);
                i++;
        }
    }
*/

    //for循环的循环嵌套
   /* public static void main(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 5 ; i++) {
            int tem = 1;//问题之一，如果把tem放在外面定义，会导致每次tem不重置，导致结果错误
            for (int j = 1; j <= i; j++) {
                tem *= j;
            }
            sum += tem;
        }
        System.out.println(sum);

    }*/
    //如何从键盘输入
    /*public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入你的年龄");
        int age = scan.nextInt();
        System.out.println("年龄："+age);
        scan.nextLine();//由于nextline把回车识别了，所以需要手动添加nextline消除影响
        System.out.println("请输入你的姓名");
        String name = scan.nextLine();
        System.out.println("姓名："+name);
        System.out.println("请输入你的工资：");
        float sa = scan.nextFloat();
        System.out.println("工资："+sa);
        System.out.println("姓名："+name +","+"年龄："+ age +","+"工资："+ sa +".");
    }*/

    //猜数字游戏
    /*public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();
        int randNum = random.nextInt(101);
        while(true){
            System.out.println("请输入数字");
            int num = scanner.nextInt();
            if(num>randNum){
                System.out.println("猜大了");
            }
            else if (num<randNum){
                System.out.println("猜小了");
            }
            else{
                System.out.println("猜对了");
                break;
            }

        }
    }*/

    //根据年龄，打印青年，老年等（当输入-1时自动退出）
    /*public static void main(String[] args) {
       while(true){
           Scanner scanner = new Scanner(System.in);
           System.out.println("请输入年龄（输入为-1时退出）");
           int age = scanner.nextInt();
           if(age == -1){
               break;
           }
           if(age <= 18){
               System.out.println("是少年");
           }
           else if(age > 18 && age <=27){
               System.out.println("是青年");
           }
           else if(age > 27 && age <=55){
               System.out.println("是中年");
           }
           else{
               System.out.println("是老年");
           }
       }
    }*/
    //判断一个数是否为素数

        /*public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            int num = scanner.nextInt();
            int i = 2;
            for (; i <= Math.sqrt(num); i++) {
                if (num % i == 0) {
                    break;
                }
            }
            if (i > Math.sqrt(num)) {
                System.out.println(num + " 是素数! ");
            } else {
                System.out.println(num + " 不是素数! ");
            }
        }*/
}



